import { request } from "@/utils/request";
export interface oneuser {
  id: number;
  username: string;
  avatar: string;
  birthday: string;
  sex: number;
  introduction: string;
}

/**
 * 管理员登录
 * @param username
 * @param password
 * @returns
 */
export const managelogin = (username: string, password: string) => {
  return request.post("/user/mangelogin", { username, password });
};

/**
 * 分页获取所有用户（包含搜索）
 * @returns
 */
export const getallusersapi = (start: number, size: number, search: string) => {
  return request.get(
    `/user/getallusersman?start=${start}&size=${size}&search=${search}`
  );
};

/**
 * 更新用户信息
 * @param user
 * @returns
 */
export const updateuserapi = (user: oneuser) => {
  return request.patch(`/user/updateuser/${user.id}`, user);
};

/**
 * 删除指定用户
 * @param id
 * @returns
 */
export const deleteoneapi = (id: number) => {
  return request.delete(`/user/deleteone/${id}`);
};
